﻿using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace CourseManagerment.Common;

public class NotifyBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    /// <summary>
    /// 通知方法，[CallerMemberName]允许获取方法调用方的属性名称
    /// </summary>
    /// <param name="propName"></param>
    public void DoNotify([CallerMemberName] string propName = "")
    {
        //事件不为空执行，达到通知的效果
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
    }
}
